//
//  WmcEditPhoneVM.swift
//  YPWatermarkCamera
//
//  Created by 周诗松 on 2022/4/14.
//

import Foundation
import RxSwift
import YPNetwork

class WmcEditPhoneVM: WmcBaseVM {
    
    var updateData: (() -> Void)?
    
    func sendVerificationCode(phone: String) -> Observable<YPNetworkResponse> {
        return WmcUserCenterAPI.sendVerificationCode(phone: phone)
    }

    func updatePhone(phone: String, verificationCode: String) -> Observable<YPNetworkResponse> {
        return WmcUserCenterAPI.updatePhone(phone: phone, verificationCode: verificationCode).do { response in
            WmcLoginManager.updateUserInfo(phone: phone) { isSuccess in
                self.updateData?()
            }
        }
    }
}
